package com.minisoft.utils;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.net.url.UrlQuery;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.HexUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.DigestUtil;
import cn.hutool.crypto.digest.HMac;
import cn.hutool.crypto.digest.HmacAlgorithm;
import cn.hutool.extra.mail.MailUtil;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONNull;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.minisoft.jd.seckill.Killer;
import com.minisoft.jd.seckill.MailSender;
import jdk.nashorn.internal.objects.NativeString;
import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.Test;

import java.io.*;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

/**
 * @author JueSu
 * @description: TODO
 * @date 2021/12/7 13:11
 */
@Slf4j
public class TestUtil {

    private static ScheduledExecutorService executorService = Executors.newScheduledThreadPool(3);

    @Test
    public void testSign() {
        String appId = "mingyuanyun";
        String appSecret = "bae5be1a7a";
        String timestamp = String.valueOf(System.currentTimeMillis());
        //拼接签名appid+timestamp
        String stringToSign = "appid=" + appId + "&" + "timestamp=" + timestamp;
        System.out.println(stringToSign);

        // 计算HMAC-SHA1,并转换为16进制,得到最终签名sign
        byte[] key = appSecret.getBytes();
        HMac mac = new HMac(HmacAlgorithm.HmacSHA1, key);
        String sign = mac.digestHex(stringToSign);
        System.out.println(sign);

        // 设置公共参数
        Map<String, String> headerMap = new HashMap<>();
        headerMap.put("appid", appId);
        headerMap.put("timestamp", timestamp);
        headerMap.put("sign", sign);
    }

    //下载文件 https://assets.huafacrm.com/web36/wx438a1cd11925efd4/1615346363000_90.mp4
    @Test
    public void testDownload() {
        String url = "https://assets.huafacrm.com/web36/wx438a1cd11925efd4/1615346363000_90.mp4";
        //header
        Map<String, String> headers = new HashMap<>();
        headers.put("User-Agent", "JavaMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Java Gecko) Chrome/58.0.3029.110 Safari/537.3");
        headers.put("Referer", "https://www.huafacrm.com/");
        HttpResponse httpResponse = HttpUtil.createGet(url).headerMap(headers, true).execute();
        System.out.println(httpResponse);
    }

    @Test
    public void testAge() {
        String idCardNo = "440233198502187014";
        if (idCardNo == null || idCardNo.length() < 6) {
            throw new RuntimeException( "身份证号码无效");
        }
        // 提取出生日期（假设身份证号码格式为18位）
        String birthDateStr = idCardNo.substring(6, 14); // 格式：YYYYMMDD
        LocalDate birthDate = LocalDate.parse(birthDateStr, DateTimeFormatter.BASIC_ISO_DATE);
        LocalDate now = LocalDate.now();
        int years = Period.between(birthDate, now).getYears();
        System.out.println(years);
    }
    @Test
    public void testDw() throws Exception {
        HttpUtil.downloadFile("http://su.bcebos.com/v1/creative-brain-hd/multimedia/DFD9237BDC9B4F1094CA89AA3E94A877/creation_1726801106806_405.mp4?authorization=bce-auth-v1%2FALTAKPxUA3jj8b35CQnomxZGQN%2F2024-09-20T02%3A58%3A29Z%2F604800%2F%2F26fe6e8c76cbd11a85b92ccb6f83c26cd964e4979d21d792a75edf9859120c92","D:\\temp\\am.mp4");
        System.out.println();
    }

    @Test
    public void test() throws Exception {
        String password = "123456";
        MessageDigest md = MessageDigest.getInstance("MD5");
        md.update(password.getBytes());
        String newPassWord = new BigInteger(1, md.digest()).toString();
        System.out.println(newPassWord);
    }

    @Test
    public void testHex() {
        String s = "BC778467684D370CB441111D0AC98B176B1A615E18A32417854CDB521112845603A01DBC149E2AED0DF178E4CD141C39A7265490AB6DFE8A8A128EE9D4381570FD952B631145A6C1C7273755B141D44B28A9F2B39AB0D4E40EB8577D3F578C3E0C39DE480B8D2DCF25E79EBC045A5E394CFB83BCB6079A01E8E829E05B8044F886FEBC3269F192346F69417EA205D038F02D50B6DC3BADB263A059029541C8825C3E42C65B109CBF7A94D7599BD349E92E277884A8931D940B90B88C68A57143BA8A97E799D288BA141876253D1ACB75F974034F5A90C265EE08ECB068885235715BC2E08A52F69A2939A672748A02DB0B41A91632018155A4BC3CE959B17C0C2F769096F4295B8F3F9F49F894C201F38A21108E0E9B7A917E87394AF70074E0E10EE7E5713723CA352C977496E5247CB967825483C34BF3375727800F8574EF3355EDF0F28781BF85869CEE4C133CF021EED757A419E0E621C4D5977ECA302198DD053B345E19997B1FDB1E47CCD9BCB95DF75BF23E09234955F04B6B414FFECE53405C8338F2907A9A59A2A095808A5467CC6CB03562FB1A1FE599C766E8946708779A932455C962F4AFB8BB54558C9634C08D12CF9AE544B66AE31454B01D2B86CFE658461393B114542E4D01FB34C37A6B07C8DF95DA426BF30BF46910688B9C27EA4EA35ECDFB629200E3A685C4D357519F1F4C800A41C5CCFE8BEE65728718967630D0C0EF4465D40DF4D321D91CC671DC8B0ABC32DD550A40972E1AD5279B7EC594DC21429AB219371D36AACAC2230C7E2BA6153D8923EAD2A1EE7BCF58E2E63589D1673E2104D4D1D570174DD437CC8E87A39741A7BF03CC66327DB3708E21C980B5CA7A7DC14DE0ACD64EBEE55BA0ACD34F295F2D11870620D3D6D300A75EB77E2AB53F9B4F6935343D3EAB6A185C4EB510A597E0E95ECC03586477687FC403D8682C28DC91AA08ACBECF3F6D536E6925BDFED8F977E640ADDC063D63A0CFC8E1BA3B5880EA7DE590606A14786F37A5B95D164EC11804598A4AA198733CB693F27402E67D85A4F22B8B4F92D804613658D7F72B1A0C7D203B86089327FCBFF7870DC06886BF5A19D80B6F89DBBEAC6E254D6F4693A61DB59B6344258EF67982BCD0EE86787BE4707748AFAB921656E3A350752F9DC55CEB5C0A742CC3E92404C9B98221E50DA349004BBE1D0F55FAD767DF405423B5201FA0DCC87E587A39B1842F882170C625D68997D588B152EB916E2862B67A6A3F72A14FADA59BB47997B21E94859DA21CB3711AAABE9B3B7F7F3D617CB9E2592E049AA9D58E91966B813B0FC08A48A947FE1C3D66FC526AB3E15B70EA88F7ABC9251AD5C480D6C63C88B4D8327C6526AEB819D81291B98AF27E5799DB4137C3BD32D76C2887EA9DC39BB31A04D677043753DA2104556DD23C240FE7C6C429676F2D3BD6109606FFA825CACF623B6387F8EEC30B2553515D60EEFAF793A7BCA4DA9EA877DC0D4FB25C0D83A71429295CD8FC67EF6BB84AD26E84DBDC9C894198014361E8F2A79B640D667ECE1416D7239C8AB5DCEEFC1C3BAF7D617F30183DDC8D655FBB2667C022536A7705A4D7D30E43BBEF1057EBF9BEE06891BC8404C1837C809E2EE60A3A327CE445316AA5914AF1254C95EAA41C75AD0E3A71ACF7CFC340ED95E6B3D10668111707658B543B5E5EC12F6EAC4C55145B4A6DE98D0FC49FEB5CBC508A2B6093890AF43BD6FD5E1F1D4B6A0A7E7271CACD35A5C7F2C23B0444940A9CF468F38BD73C9C178E83582E8693C70F2014403C19DFBA539810B8B02E8C79313F5473931DD2DA3777E61EF804E6DC4E1728A02FA37FD2C93BE6FCE9C4A15F8DAD1038E9331F9FA313674378B4857D4CB287C6EFF3E79F2AE455ABAB6B1E0A08D153309707C8822620A5DF9DCD75DDBACD544131127098464E17D530AFB7F4D819C329D7782C0FFB459CBB4E8E2EB55F36B96B88BC461A767E0176625015AD94D227A56766112E1EF503411CF2E79723E7DE7739E9E2F087DD3EC759ED12B89231A9C11D49522A284435BDAD2DF2D1AED12393456F8957FE29522D56677DB35943DAA9DFDA4A6203B243F0C36507098C809892C424897B2DCDCCFA8B1D3FB936F66E74B9DBD54BED41AA6EA1BCDB0C99471B5C8A7E7B1D840D8C647F6F8B5B8198E39018897B1721A6D96686A8B526E0FB86964A45CEED86EB7D55EDC01A6F1274BC2CF9654C20635D49E0F38F64C0B4571C3FB6110F7C9D54F90C4B46607ADBCDB847A07239EB38BD0858BF9D514C1BE181315573EBA339498EA2936938BD77465337657456DD1AE4256DC15E1011642D33BF90A69605818DECA3A5FCE31B943708B23BF40D3875960E655FC09CDDE8C36EE6A023ADF1949EC35B99D915DD1345A09E8873F97C93057955CA1C7122085DCF5B047D05BD9E104DA2533C470885C25E03D0133D75C4EF36B59B2E6B340B4185B3F825F63D21E3FDE3E6C0423274C6CDFB2263D19DB91C6A1B8BEE3BBA83428599F7715208C38FECEAE16F46AEF9E1909319A51622BB5744990D55A71AE10B5CF84A960783D2978E0478882DC61AB3F4F86C8212593F8084561ABD1E3E805DF879F60DA2FF6F150EFB3E7612B6ED3324434158A71D7DD33ADA67A734CC05F0AD897A35416AA65A2FA86246AC727AB9D86F0AF613D7619560269471C045065DAE19E365FE405E9424BF6B6DDF2A30FD9C6DC6DBB10D7057A40252B2C6C1C75C2BDF52547273042AB069CB1CA04163DFBA8CFCEF08021C29A61C94EAE990918F79FC6C7202CC31DA6C90C00EDA3C1FB0BD6BCF056CE02E1B52928DC694AFEDB3779CFB90A2014ACB699897950A7C0E6E0129B923DEE8B91A8B30CCADEC3B8BEC8C806DE58F800D2E9484C86212385A99EF8A08DEA3FADD287BE5320FA486F60F5A504D671F6126EF4C4DD9881E3F996CDC77144CFDF733C0B8C57F4997B0FD4C9AD3616ED65A41F8ED048CA62418F4D20A2C3E756687C8EFC062D0371085B79F2B05ED435022434139BED0A591537C168A51748D77A9BA03E168BCCBAC5C505D2674112EF34009458013467A08AED49BCC9F4DBB16E12CCE957CCE4B2AB2C3A21223AEAB852F6A49A5F5123CF23F2624AA60F14CD16C525AEE355C61B78C14026AD5E4A912FB3A8FD10D87FDD92CDF1985042AFB7C3BA849FAF6C07B45E07010C35DFCEAF3C39F766F6ED76F30DB40F6C0389353A1A22E3655E8B5C6A99E5E49DB95D4F657B9EE11F81DCADFBC56799CCEB7DF21DDA9164549D771D2BCB0EDF2E75537835B7B5158AEDB9B5EBCB0D873CC64AC63DF4A9B3DEAF18419458DA99C71E8FD1CC5CF4525B4C577762F4E1A05618A65C49AD7872FD204E5726627A595FE1204DADE362563679DC507439FD0EBAC53CF9801949A58AC55DEEFE611D960C7C69649577875413CE7B604C9BCD1DF30E0935AB15EACD0E50779CB96A4DE66276801ADD74EA2D5D1AD26A183CCECC3BE0F2DD6CC092D017ECCEAE6BFA47E9798EB4AF7A5F1BBCF57D31797B4CD44B02E859951A4653F7589B027362C94E22FF1AB0557CCACD5AE5B17A4B5C342648AA65C274B7D16E553BCDDA88DA2C76D567DFB5652B61225D5970F0EAA255DCBAAAE7DE073853C1096ECBA97816BCE6BDD4FBAE76AB83E1BD7DCD44F558DD800B0C5954721AB7202272195EBC65FABBABF47BE28FEE4AC09259C161C9ACC03072477A8B4F11BB27A3CF2F87134D38AC98A597ABB3B0D689F6B37D18345AE4316DC9A3AB7E72575A464D2DCFDFA2642EF5F0E97334F0581DC71610C7B96DE61D30BA3368B4DB7EE22A1569E288081A3E2A6EA086DC40FBE63D195DC0ABFC55AD32904AD2E78974E2A0B7E1F68021AD3A76F3971AF11B503AEA5CA25095275D26670B0FC1F76630CACA3C4FA845D81F3302DE4A4D3D223995A5332EEA184F05F5F6261A31D5C2B0E08E699695D662E3B94036ACBE8DD40A34773B87B7766BC7233AC23BCBEDD6F0908F424360DA6020C2CD4CBE92C56EF105117A4E3E90310B9CA87A32063AA759A58424CD5B2499EA71602229F94E356B9DA099707E5E0A0B2CB4D1B357C30F35CE540E1755F660EB64863940A890901941413008811DA33C75D533D42E85556BD89831BFF7DE0CE96D4F31D5FAD8291ED6A9A8E3C43951B686D29F2EFAC76E1B5E83171176065BD979DCA60B5FE6DD7A22B1A40257667E716E9F6E53A6C91FADB1AC8B9F89BB77CC659693B436922E35D35F30C13081575C8D5113F1BCD45CC68477C1FB9A60064379B3B49BD1E51C73E02E0FC616467D40FB255D3F02D7DCE5BA2B92FDDB9B43815D8AE619A1A3AC25A209D6482E0F2066DD7A8FAD49628423F495B94D01B3C2B5DB52E0671BC76E20D2C24AA62D304E295EF36735A8B57B11CFE9F0BC2855B427A62AC11163FC6593A13E4B82C29604A9D823D1C5F61F767FD62E66E2346F207D111F55618CE645480E0C21D1C1B3C1F9727D93134692EDA93975119F0D599B727A4F85C9C676A2372844572BC5CF0EE1377067ABD943A6877EF197455E873C598C089C3AA7E9CA51A783257936692DE2EC1E8D0A5BE03095CD85946A8609B07436EC016F127D6D0B65F475DF9ED768876540D352005CCBA733F951EABD8DFB45681FC606058830E85A771E97EF707F9B9A06C0B96525A0816DC44A7A130781A5F7BE897CCAFE4AB27A8AA64AB9E04B371171171D384BEE83073417A8FE30282D9B64C968B3E5C142B25D59607318E09F0DD1816113ED2FC3DCB8A2BFB8E37DFC98370DF1D84FF9F0871BAB06FA029EC047CD9EF3E7C595096834AFAC5F1EAC3FFC3D2716098C3DF9E103200FFCA21EA34DD1F12832D1891CAD82A61F9E31CC4EF716FD8542CEC66561E681DE99ACC51231FB900446E5852BE0D0C7897C0A9CDC575198F463A938063AE10BE69E0E4E586EB69672E16A8CA6E1A482D001554A0DF8EAF7990E5660FD89BDDAD97F7F5786B47A283CB9F553F3724D4FFE3FA78C12603A66DE7F0231158C5CE68F34FB18A51A0CEC36AE664D01FF912FCFA55FF1F7DFB72514256CBE1FA25233C8DC8A1592753EFA3C1FD52E7497A6C9BCCDC9605D014BDBE1951DFDDDA40CFAFA4E8AA181481E13461E60D83D14F31922179268511DF2238E50C464C9FC23C4366B101AFC0F8178BEA24FA95527BCCEDDF7E6BC12294908E16364A23444B33A8ABB9CB10B4A4B395DAFA11618E7604AEEE0DEC69CA2AC69BDC3D22DF65BF1AADF892E809605B78CCADAB7673ED915E2593B4E359F758D11B511CAFA50846FB580A90B8A0AA06FB2CF13E914195A037CC225693B4C690A66F034659733D21F805753F1A2879D26669FC925CFD2E367667EF6816B2DB5052A09AC1839A3FCC74F68AE4B2F89511302FB05E19F0C507DC90940115E93703069C3084DF27AA8A071E97414E29D11D12C8D65C07241EB03DD31202DCF35DF78C3109E30DC9F4ECB5858D344C1FBC7B2D440E15DCB4EF31780726C0BB5022E92A8F3BD4972D1012274BB7F4101C5A7FE86A2939B0812F1990E26727B173A6BB562633F3D3AC8D152E93CC5CFF51482C22F221CE3ADB152E9822D5D967218A67E15C77E2CC4EB1BB0F01A3D1BCE349C05EE505F6FD052A4EABBD698737345EB91B85CB3AB3839A24E0367131EB7EB956F6951497447621E91DA36B746AAF6A6BBA72290E9AFDFA63CD54D3BE7859B22D1513DBE31F5CC20B98988AAFBD2F1BDF361B70081F643ACF3791E0A355A357403F95F0B483BCF241DF071C479CA2FC2C6CFF0191354352E2C7E5F6534EB01BF0137C22A8B04DC667268D4E6278563475C6D4737202AA944C71BA0B0F9042ACA6FE0C2B3A8FAA81A8A7FE862A87483D8C3888E3B2B85963FE33E09829F45781B9E45730FAF121984B9D5053F25E523E835A5741D8A487B51424D20EB4E9E82AF78FA16CBC743111A3646B4F92058DEA55058CB2BBBADF4DB4946560EFA9F36B74BAC3B338EF9C7F4246DFD4B12824EAF0BF0AD92E126BAEEDF57D216109E073401823B489DF9B609CD56275D7E140DF175F9E9B6F3571CF417E10CEA62550699DA13A146488C0E0115497E67E2B2BABF5AF9B8B7DB4E6A334301EA8A8243943A6975A537F7FBAE777AC59BB3ED77F9012A230E90604F82A26F22F8B64299623CF8BC1B131ACD1D5ECC62BD4190078B290A484C0CC0C999D23519A331FCE45FD92EA750F57638A63859D37B658D31853AD5004BF2FA737912055AE573660D7D4D9BC32D408C8FB2A940BDE48F4AFA9ADEEA47B758D9D2252085FFDE05361B157BBC8237174AAF1301E9F04E290B13C3AD99A10F70C60A78839C4C33B2C329F140123D7DF0F1BC85074C3EE0A78F50780BBD1D12C60CD83B50FB10AD94EA9EAC1EB5AC722768250076043716CFBA4D502141A7C4CC928823F2D9EA71A105A5F191CCF66C16A24C6EF221F5F5CBD6F765ABB2E04058F4EC1608E02B658B7CC82E8095F9563788ECCD9A83296A0778505CB9AA68B0A83EB7654F3E8D17DC4230311F51B82A2FBF3A1B17D61FFE644C127AB2A020A74D90AC9090CFEDEC369A6AD161D4E57E20CBCF5B91DB19F8E6AB79B98C6E0BB2EDCED0F515ACF9BF52B6297F12684A86BF6791EE4A23E8237346E509C1B8C27821D3FBA751E179F14B9D8A8B85EE9DCD073ABE2B14DAC9C7F4AE56574FD5EB13099F7028C9C58D0F791D684F5E5E8227627421B6105BC10C5FDB1FF7C6B1A6B34F6DA837DF16C61FD66A33169864BED46C5DC410B1E8E9C9157BA24E33EF7B1736772D35212DB962692FA7A7D883706E14ABED818E1D3EE664E2940DD7E0008F5141450138AE31BB32A4B3E5AB2F9C4ED5EB4FFFA5280AC463E95D4501C7C4EBD936FC241419B2A0F814B3B8537E743F6ADB216BECF552A1ABA9335F1EC627414C9A0B81C4BDAE433921BEC375D397229F8F40573CCCEBF30269ACABF4D64D155281A0E30BD26C7633078A999225708A563D6AE4B079C9235EB8D92223B785C9476C3E7B19CBA35B0259EA0C3660ED94023878CAEEB98D89905C56600D250A95C74D97AD12782D5A74E33C59ED389D3817C8EA54C60AE99B6CE450A591845DD3B576030DF93BA8C9F432DC7875ABFC2823AA0ADDF7FC88C46D9599F48500AA9DA34F1BE6C3F9773CFD63D6DF0A88140E360377FC8432D91449C86296A214B5990F1766293D7738DF45D0D355B899DD58269540FD8B5EE021F949468015882F751119C1009E456A26EC183FB9287E7E7C27959826DD19B07E0C2C334DF8A688975FD9697F53AFD70773A3FCA2A45AC45E37514F4D50F47687F413D7A6C94DAF24A3F9F134CAD91F8949D37C8F896F23E30FA9871129049A30D71D20D2A1C95E9944DEBA9FC8F71283BD8C1CE5BE16A029B29239D7C56564CCF34EE6587DF0E35C4F65606E4B83B393F370B4C57C7502EA95737AB740E6D796928A5B873330AD0BDFDE60AB9D2856053F39E6E46565A7DABC471025774F82BD0647E9B62A5F80FF8F956E0D68F38854BD700CC3D2285D7179162C370201387BAAEEE8059BF050645AB220E34FEDF8E2BBAAAA554F084426EB2450F7A63275B40449CE7078095E2FCE631DB409E9647BC175867877DEA27C2405BD214604888642A51BFF07DAC33D0C7C8C3038E25EA9340516F7F83E958B70B88789ACCA530E1CE29087DB63E248B0230208C73EE6813640247E7D1FA25F3007C7E9151BD20BA3147AE99CA2958D8743C059C93517331A38713A0A1D12F84BD7FEC7B35B56B57E33FEC83595379D19F952DC03D69C128D1469DCDE694A0109392F351B6311733A85EC75641901ACFE991CE6FD7D15637C204D10434E98371C4B02FC52BE5FA3D697F2D9D1A1A22B7160C55E518F31FC1662F1B86A1DBECF5F22A09CC75F19CCBF08949A0F89222B9AAF8365CBF514B44E4187BA5C78349BF9CF2FE1BE3AB901BC3232B3AFB35BB643B570C4D958827282E515792987BB998891620CF7EAF6B33761B551F73395C4126CC3ECDBFD021CFA6E25AC143041825FC02961EFD28FDF594280E9F1C4D2D297A0C4A360974E7DBC17B0A172E114A1116B05B9A2F0C57D83B0F76BDCDEBFF1B4F3F3AB67FFEBA36E655304280F883EC277BDDAFBBDED5C896C2415DFB69BCA7743049FD848CAA35F5AA83839EBC07E053F7F7CC466C8213977889FB3F619E98235FC3BD5B7EAEA588AE8D3CCAC89BA8194D4A5E148BEB3861C95468D913D3C54F37B3D405EEB7AF7DF9B42EE62F40C6441CB09A79E6499B836968D21E691E4CFD9DE96686DB96E3BA4AC4C57558299AF451CDFA2CB438C6FC557028BFB0D757FD9F83B524681AA4DD32E38BFFD8E4366AF077952ABAAC2641C11C7560A13CC35B19C754D1FD85412528ABAE732981DDA1452D01AACA75999057D956A64E3ACB898C4B3DBA7C2A650116C549A88AEB0DF3AE78DF10E9A31B9A9AAF0AA32C61AC38F82A2D1E5A7B1D30EB36E013A462FF2B85682D98C15F9FF09CD751B0EFADD7FDA47B4F6A6581FEB4D980214070817C6AA7A8ED1B88C0F7E4B1A1661FAD83F0449578E69FD9200D2D3CBE5588267A3262E00DC3070E0D892FDB6A94A2266B35511D4E019ABD384D8BFB01FE4E37A0BAB32BFC4D692B91438CCF7C61CED5C0452D9ACE5A24E3B4E4E99F7B713199D9E37BBB85DAF90A7B5A46EAAE5BE0182C27CFF8305880030333DA50A6779073506058024BD182E7D35FA7FE82A1F583ECCF47098F042D4FD16A1331213B080FE1FEF5ECADB514C07A25CEA6E297AC0A369041A893607E630654FDD4E4A79DBA9B2C175AF99F8DF84563FCB43E51CD52C63F04526F1C9E78CAC80795F47CC333E116EE5B51C0560150EA68F17FE8EB349154E94E7AF369C0ACE7E7F384F97110C762ACA65A9CA29664277F80C195FE0D010D93BDD9977E942B0BAC2632127BB8EA5A7C36855ADA24685668F7A9939461CE9B959DCC71C722B73D6450584B3BF7DEE1E5E3748A0596785D236DA909E133916C6B532A174676F770CBCC2730AD1E600A669544AC140E9A3674969968BC7C9B4FB62BA27A8AEDAD6470DC3A9C35D57229D4D6BF996064E457B9672820BF6D2D9E7B0F9198320E5840DE658ED0D0380C012F2CAFBC2BBD1D3F811AC169A11E3C8901B91A386C576BDB54605F0DD8E906A6ABA70F88920BF395FE84B37C3965C8052E95136CBAF6B404FEA32C02BE9A3A423E9CDD42FB3707FAEF637D390D8A2DE4F4E550126A775387CD15F2334D43A285F04D1CF53E47C5ECE898AD4500A91D7883B380969B4FF9F9F8E150102E0B4D40989B7B7DCC296F3764025AA5500CB1B09DA7FD8CA26F8D61A21A86726CDB0AE97520A3E05B9344B260C2828994D56D0B3CFCE807274C269CA993997AA56C2D4C09B911323B9C8D9F86AE2FD8542A097650EACF7D2600E30055896A7767AE2167781DC3E49E278CA663425E98AA38C120944C4DCB9E3187D6F3238813D880606E36FD38A125446A0DED2691A23D219F7D4CEA0EED77E9FF43BB0C0AF00AEFED0E340991DCB69B6F7AB52EC2E63A7D41E733E038E97AE48FB87C78A3B19EEA40FD63FC65C3096730DB245584815AA0BEEF2CE44DB39DB8570FE52D4B4D44CD0A936AF35E085D5DDDC64C2BC642D93B13B89B72A203578B7C062C20A5FAFD28FA98D5E37177787F143AF3F125DE03143CC9737A7E5C5E218551B5698918C93D5F656430486DFEE63EDA822170C7031E96D7D89A5C0A231372F911407F6C80BEAEC4829402E2F27383491710272E2BA7E24169CC0B8E524A2D60B225AF0B3987C711F40003BEE50DCA0CF21344325FBFE5AC47EF0CC228D6F5157A93A84EBFB3C7FBF7E29BD8525F438CB7DE5BAF1D8B2201E33B126A235CB6B44DA8429E0097C5F7FE45866DD55F1718EED1BE8D603B53EE7FA24E0AC964BB806FE21D8389F84E8DCCA7C251717193C345042DF838039219CC8D46D93BC9C11DBCCE196CF82307AA94E934B64CD8BDD26DE8D7E969E829CC761BF43B4D76BEFE759ABE64592C3FB003653570338025BDC6D6F1530BD301727AF999BA85D28F2DF8E11ABDCF4828E8E4B52E6DE7BEC615A8E63788A1D545A382DE17469F1297AB4037E0A5EFB8DDCE6F26310469F542ECBE026FFE17021E8907559CF76FBB6308210CE284D3DE20482DB4D12827F98AE2B5EFCB6D9316C07EE2802222E9CB02DF66AA0A2D6154A86E976D90BB745EFEFA3C7ECB67E397F105F3D680D4AB985FDF9FB224F482000EFE3A1801671073002AF910A892487204F3714F4F646D043B13446979A76C58F1408393EE8FAF21C96AC6FDEE3DF49ADA55A182E3179A42A396E099F086D31AB417EAA9D69E42E10E4B925375DF5C59DC94891E75F4987D2E355D0D44DF6678792F1D5096E18808C474B016301CB0EE0C89B9719AD1F5910FF28160CD9C9C3D05B11C2C1AA3D5155CF8BC650FE0674AD6BA3A042A96303960C9B2D1BA19E80888D7C349D84A2851C7C0ABE3218668E7B2750CBC0BB3327EADFFF117439B8C01FB0CA93F3E0548F25207085755F74FF5B2A3D9D6B42003DDA4D6B3F10CCE40EB6D01B59DA87C04171F498AD1EB097BB7C3C2977049358D68B0EE75CBD5A605788D046B2224E9C10C65CA2CFC14101830BFE40336E810AAC12CCC4052B024EF1A982EC25D57296E96FC63B265BAB7186F840EF504866B1E310179C2F7199497096EA6702A807C27FDC25165DABB610A25BABF802BDAA09864DF31A87545CE6D7F4DA202A275B337A55B008658280E96EC97058B060FDDC164D203D294DE38B339E208EEF0E0E22F526814EC99ED5F118B25ED89702AE034FF4BD9462177756951D06A38337B06802C4328B58693C727760A04744C1138FABBBF53798337AA4CF47A4605CD93F86728DB3FDF74176CE0584E071F09F7A83CAB3C7A39571A8D4ED6558AEA4E6AFFCF2AFB1ECB9E98376EFF4F5867A1FBBD245674CDA11D8C418A521B308565CE66A5C8B052FAF3CEEB55FF5237A6F71E99B5FFF7AE3E9EA3FA3DCB0F25A41868782D929D40F0693C22CCF442695AA879C43B540F2C1F57C0B62A517F9D574F3B81FAA3141D1E512B49E1588290597D4AD603EF2A0358272D5632B216DD23C8D7E5DAA15A751B094572D33C796B8B17ED60A7FA1AC325DE39388ACC01B4901F80CD5B504C3FEF0E2AAD0FB0A200B30247CEB8E53B2B9B07AD3368CF81F0E1683E641AFE52AA82983C12A33DD85070E1FDC6EE697ED20DCE8FF9A95F07D68986B9E8CD57B3496893FF7828F83ACF1EBA5A45EB05346440C302CEE3D304CF66A91D808DAA04BCDD4BDE5052ECFE17FBBF4DA497090E67862BD88F2E529BAE07E1090B465727FD1E9A6C93FC21174C918D1C820D6F0C11DE6AC5782D027710B88F976D6FC979F18435DA524BF435C2064DA2A8BEC81ACDE86FC196396F17E3A77A5EDCAC2F084170028BA3F1A1D4C1982DE10E25DE463FB7F71D1746AD6BE93BDE03B8EAA50A12A90C5C62005798F5EF2F9EEB80DAA2624DB350F93A4A77336DB37D32E841BBEEBF935B9085299F8254BC11312502283F82843B33A8E8A019BB57016B0B4153270735ADD18FEAEAF1A29058FAB0A3CC357E52710E283ADEF0129BC3967E8D865E1774EE8CD3987A9C21880035B747A6F58B2DA2ACF3AE8D60292D403EF7B6F34A40E2DC164F7FCC33EBFCAAFE110758BEB0C08BC429FFF55D2D44133C3135E8FED3A17D03F606A729858FAAFC3151E4CA340B1548689BDE07019293B366041C031B54AE89B2893A946790061F35192EAF39377FC856E6152659CADDC9560CFC436B05772823CCD348F73F0ECD1D3A33D229029DA43506B69715F4B7632B5B6ED98D6774FA86D3AC16DA354386C113AE650AABE67E8CB882E9F4DB01746FDDBFD36141F9EC59EF33CE9109455FE4EFAE2070DAA23A3DC97C0AFAF6FB75C262F18B2325149E2EE23E062BFFB48EAC7F6A6FAF4367B657D6B3D96BB0F9AE68E05F659055FE0A175A30893CA826DB028AB05691D33A0B03F0F9C0DCDCCFA7A70B28F5BEB29ED6B30CB90FEF638CA007786E58E78F4C0416530157C9EF94D8CD064DEBF4ADA2322C27A18FF2A832CCD3737D152738A36F2CB4A449DA9D83022AC393EF6427CBC46084E6F680D77C5552B1DC76DE310678F06C971C067575A2DBD207F09F1C9CA946EB38C9A8880CF13E5DBC639E8A9B37E49979F25F70F07F9C7885414A2C90A545BFFF736E6671810E125B87BB64D868C0C5BC9D11D79CB42E34A51CCF292D516858DB4ED26DF8502472F309F86A8319EDCBE48F7417CCCB0980EE8F1DC3FB2C8A9486163E42256317A273323BBACE44FA0735F19F4703881379E0A38C6965793E573343AF2CA4CADD3D756E8F2E2A51A940F91BBD040791652F32735C23F121C065B9ED56F576A26F07E0DDB5A4E376AE74F7B265B32E5238AED38395D0597035095179BBF942E23F23202E2E5FEC2E072571FC1B57D82B64B423C33CB475286BE4394F4D8316D294BC1019F4E78E1A36377BDDEBF4028BFC8DDBDFF473C9A696FFB04E7E5E55EF5BF509BBA043004C5A59ACE0DD535C01B144C8F6C6AC527B4A743C829E4530182AA021BEA1D8CE348CE9AED494768E88FD8BB22B882462D9E8F1588D878E5504251250E2DF20FF40807DC98CBC75A0254D8351C9E579D2784DCC6EAB31AB5FA7F9B64A5E24393CDBB94BB07EB6F16F9A5CF69BB97FDCA48098ADB095B0AF168A87376A617BE445013176D6BDA3A1B9207004D42D1B120ED90B90A41239E9DFA35D47F953CDE40D97A7C6DB81A40B2A9E59B35EBC03160A9BC7B6FD512B5EA04B93D9C5BB6CED8C966B6369BBB14BE0F27B910712E333235411EE742C0E7086B6E5832553BA3F6FA9D9B2A444F21607A6F9EAF1B92974F7EB07C3422CB67D8A574FA3DB5C47C6944AA1E612FBD6F5C58E15BEC89D5566413D0205589689B0ADB28731B241CB612EE606B4681D5ECF5A60AFA0642A7CA6561F1AFF2281E8D43E069743E9DCABA3FA436CF9338312F2539759E30169F33D3BA88C505D028B44127F9923B3022B27FBB2A1FDE8CC5624461740251F2B78BAC4242FFF9D8CC1A37E14108382241B21DD1B413CC71FD4B8BB06D3E18EA6116C3AC3EDAC3DF072BD9626B8D5A574C02118F2C67959FEB16C0FD8C389E2DFD6E9101A00BBB94282343E3F5228DF25C673E5801A6335A03CCA393C84BD57C8DB10C657129442BDEE001D02299231E4058E9FF77290295104DB8805C7D371A07B6478349C0C5A1CB944AE99C4101DB7F2D7944A2103715992B4BD1B07913B81EC04A2E94822ADDC3DB3C32792071316FA7A9081DE1F95D441B9A3FABE288875E51CBE1B487BD55A410ADC1F0A4EB63C476334C2694026F525BBD744056E79863C2788A0802BD6C17D69712C3A64D283DE1A7D6FD12826DE11458027B335E87E7371335D32EAC9CCD771EFCFA1E33F2EC456739A3D7C7C8A7157B6A65EFD42547C2F120E0BB0680E5541AA7E02FB942A3E86A1B107E156049BEDE0E1CDF2AEA54C57BFE57F2348836ED990D7567101711B42FEFF23D281DBE0756B6A7C5174E2F221AB447335B896CEDE872E6B257739F77C08EAB7B1B3676010DE6C3098653BAA505813C6B43C49959C5D7F687F82CB06B7ACA960D86C4BB40E6F75FD3171E8C7E39303B67DA61EFC21BA13A160659ED0160CBEB1507C50C44E8BEA8C5B89167D9101AF7DF91BCF3D39C68A94D68428E7E95BB8A46D25C9A2B5F60E8A87EB7AE4B8C0AE7E0433E8B2345CA99FBE45600B261B8B700B2F213C46F7456DB3DD323A4D5C2082AD37B1ACAB9C1B70B01B0AA0ABE865322323D829050E5D4EED91F4BFCE80C6DEBB9B320C558957658AD6C4E707A69410A375DBE89AD376A89815263CA16C364D86FFC136AA05F09AF1654389968BF2B20CCC9083EC745DBD34DEF5AAA7630D45A77328DF720C3F0D09AB23640D7A4A03D9B1B4F9E94EAD7BC15FFC6B332693BF7C03769DA10F662F8792BF42266FD6D328BD667CF464693CCDA1CCE699D2FAFA8B2E06D1A80D8300E4A809249B46F3A76372BE2527EBE9586C63A68A13FF4FDF8F4FFA96194BB3996B50ADBE5CDB83F829B1902697E2D4ED0B3CC1EB835C4B7340ADA2BA9F9A758F48451A1C7990600D9319764767CDE1172A3621FD456F00A349275AF46C80A7379B741D0B26374EF2A6C3CBDB588F55D02DC104C16F142D016DD9F38F88E50C2F3250BD0512F34A17D8E6B0F3492370388E44E83096ED695ECDA78F87657A892E47E4F51E3DFD930162190BC878FF0CC958E7DE79EB10CA1EDFD1255332DB50CEB6F178A74F9723E95B23FB0412F14BC3DB71B0D988731CC2743BC687A76347A6CC7F5A1639B8B921A6AA48352F53A13CB45A33D5E91F6821A4E592E8D2AC68DE7C007255E7F53C80749F912379F0AA43C39A667978189AEE2458F34127129722350AE82C3FD7433E38D00D0C717B58A3D3E14BC853FAE0D628930255493ADB82060E74D50E91C63E154273C3D9494849DA84272897D6E21AB720030A77D1C7FD2D9AC64D9D8151851FD993D83199A43862FA7192CF43CED28C3410079D7736FDF3EB86301FDB355AC392705949BE8A6E5306ED5F5049A66E4FD733A584CCF22EC4681E93D654E196B9B61BBBA62BDC882A1E2F56B72090206824826B92098B47533491BAB51787D8D677B8061253A9AD7FCA156FBE429553228A253F79EFB6E501EC91779CDD92443848CB1A353BB383FDFB4B4CFB9B02E8A41B2D2C0F2A080C96B3F30ADD5EC5F0551FC821E2CC5DA5BFC0A96FDAEB216A8E16B693BC220403EA1EA45B2F5139205D9FFAAED8E87E0942711CC7A5187B597F1A65813B12022145220AE7BBDE1B771AB0F5BACB4C1B18EB97A9D6AD0F182F6F4887C84C17AA844DD421326C031CAF40C591153DCFBE35C13755E7045ED43AC97346761A79EE4D0E487C72CE0F07B3062191BBF60E5D9B0E88AD61767F1B8A0517E56F3F09A3FD5A4C020F64FE7C1051F6E8EE9056953D8AEE9105BF22B4944A223394E6A02703902AF2862ACAB9AC18E47865F1C6C552D8B7E546228E983C1F97AB974B8FF99D6DD8F563A208BC82EA8EE1FF7C78A6D364F3C54E5E1519A5841B4CEB44E3CD812EC041F82273DA4377F7C44C1CF426CA0BCFAF441738AF06A3B7C4D49173E3BAF533851CC2007A0606D558E757078C628025570F3BAE4535CE5AACE210F1A4B2C7C37E42828F75371FA712D6BFBEB3CC245BE9D8EC752125FB54595BE1492D55E782FD8A585B3A178DA17F34892D72E85414718534BCE1AED2E4DE98EDC5D01F786E7509FB9B1FB48AAE9ACCFAA0B41198BF45372AEED2FFC53FC6C616B51138EB02FD9BB64E245B4A58A50290403679AB762F2A52097C2CB3DD09547ED6284C38E5EAD3CCFAD32C525D3B4A47B9A822D9E23EB167864C605B3E62493F2E1B150F836B15D7DF8C74E5C3730AB29778F1FF3ACCDB61873877FBF16FBB55A61CDD6BA4EFD90D9B9AD88EEF0DBC3D2564EE8B70A79D4202FB61E70D0D2250867A13D2FFE8C4102841314AE2CF245E4137A324F23D17269318F69B69BB79E7722488BEF60390870F3AB826BB5459870E827EACF09039C38D6024ED7E8BE6CCB1853178612DABB53334A64B0DE3EAAE1C266EDFE714407D53045513C522B0FCE80A4E80EF7B640D9E5B132CDF126625392F493F4CDA0F0AC7254140F73EF12F78C34D28A4394A0CFD7E7DAE06E97AFD87049880B8455E274E6C33C83A85B50249EE328CFEA4D983A7A98575872D369738C55F18001F5B2BA377AB1D37709CFC86C604FD8F3EFBD28D90E4A306474DB22E832EA48102E3998AEA00CCBA";
        Charset.availableCharsets().forEach((k,v)->{
            System.out.println(k+"--"+v);
            String s1 = HexUtil.decodeHexStr(s, v);
            System.out.println(s1);
        });
        //把上面的16进制转成2进制
        byte[] bytes = HexUtil.decodeHex(s);
        String s1 = HexUtil.decodeHexStr(s, Charset.forName("gbk"));
        System.out.println(s1);
    }
    @Test
    public void testMobileList() {
        List<String> mobiles = FileUtil.readUtf8Lines(getClass().getResource("/mobileFilter.txt"));
        List<String> output = new ArrayList<>();
        for (String mobile : mobiles) {
            if (!mobile.substring(3,7).equals("0000")) {
                output.add(mobile);
            }
        }
        FileUtil.writeUtf8Lines(output,"d:/temp/list1.txt");
    }

    @Test
    public void testDecimalFormat(){
        DecimalFormat decimalFormat = new DecimalFormat("#.00");
        String format = decimalFormat.format(123243);
        System.out.println(format);

    }

    @Test
    public void testCityList() {
        String s = FileUtil.readUtf8String(getClass().getResource("/city.json").getFile());
        JSONArray array = JSONUtil.parseArray(s);
        JSONArray output = new JSONArray();
        for (int i = 0; i < array.size(); i++) {
            doCity((JSONObject) array.get(i),output);
        }
        FileUtil.writeUtf8String(output.toString(),"D:\\temp\\city.json");
    }

    private void doCity(JSONObject item, JSONArray output) {
        String value = item.getStr("value");
        if (value.contains("请选择")) {
            return;
        }
        item.set("label",value);
        output.add(item);
        JSONArray children = item.getJSONArray("children");
        if (children != null) {
            item.set("children",new JSONArray());
            for (int i = 0; i < children.size(); i++) {
                doCity((JSONObject) children.get(i),item.getJSONArray("children"));
            }
        }
    }

    @Test
    public void testObjectMapper() throws JsonProcessingException {
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.registerModule(new SimpleModule().addSerializer(JSONNull.class, new JsonSerializer<JSONNull>() {
            @Override
            public void serialize(JSONNull jsonNull, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
                jsonGenerator.writeNull();
            }
        }));
        objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS,false);
        JSONObject json = new JSONObject();
        JSONObject jsonObject = JSONUtil.parseObj("{\"a\":\"aa\",\"b\":null}");
        json.set("a","aa").set("b",new JSONNull());
        String s = objectMapper.writeValueAsString(jsonObject);
        System.out.println(s);
    }


    @Test
    public void testSet() throws MalformedURLException {
        URL url = new URL("http://www.baidu.com");

        System.out.println(url);
        long seconds = 98L;
        //把秒数转成时分秒格式
        Set<String> stateSet = CollUtil.newHashSet("aa","aa","bb");
        String errorMsg = StrUtil.join(";", stateSet.toArray());
        String s = stateSet.contains("0") ? "0" : (stateSet.contains("1") ? "1" : (stateSet.contains("2") ? "2" : ""));
        System.out.println(s);
    }

    /**
     * 生成一个快速排序方法
     */


    @Test
    public void testQ() {
        Integer a = null;
        boolean isA = Objects.equals(1,a);
        LinkedList<String> l = new LinkedList();
        l.addFirst("1");
        l.addFirst("2");
        l.addFirst("3");
        l.addFirst("4");
        l.addFirst("5");
        l.addFirst("6");
        if (l.size() > 5) {
            l.removeLast();
        }
        l.addFirst("7");
        if (l.size() > 5) {
            l.removeLast();
        }
        System.out.println();
    }


    @Test
    public void testHash() {
        System.out.println(StrUtil.format("{}_{}", 2, null));
        System.out.println(String.format("%s_%s", 2, null));
        long start = System.currentTimeMillis();
        String cc = null;
        for (int i = 0; i < 1000000; i++) {
            String s = DigestUtil.md5Hex("appTypeappTypeappTypeappTypeappTypeappTypeappTypeappTypeappTypeappTypeappType" + cc);
            log.info(s);
        }
        log.info("完成，耗时{}秒", (System.currentTimeMillis() - start) / 1000);
    }

    @Test
    public void test1() {
        String s1 = StrUtil.subBefore("20966864.wx0ewinbalytptma00.0.1", ".", false);
        AtomicInteger atomicInteger = new AtomicInteger(1);
        int andIncrement = atomicInteger.getAndIncrement();
        String s = "12,1234";
        Integer roomId = 12;
        String[] array = s.split(",");
        boolean contains = ArrayUtil.contains(array, roomId.toString());
        System.out.println(contains);
    }
    @Test
    public void testDate() {
        String replace = StrUtil.replace("18049531999", 3, 7, '*');
        replace = StrUtil.replace("85387651234", 5, 8, '*');
        float a = 1;
        float b = 3;
        String s = NumberUtil.formatPercent(a/ b, 1);
        DateTime begin = DateUtil.parseDateTime("2022-07-18 00:00:00");
        DateTime end = DateUtil.parseDateTime("2023-07-19 23:59:59");
        long between = DateUtil.between(begin, end, DateUnit.DAY);

        System.out.println(between);
    }
    @Test
    public void testUrlQuery() {
        Map qm = new HashMap();
        qm.put("Signature","nU+mcBgr7nMavxUfzEyHI6RVt9U=");
        UrlQuery query = new UrlQuery(qm);
        System.out.println(query.build(StandardCharsets.UTF_8));
    }

    @Test
    public void testJson() {

//        JSONObject jsonObject1 = JSONUtil.parseObj(""); //JSONException
        JSONObject jsonObject3 = JSONUtil.parseObj(null);
        JSONObject jsonObject2 = JSONUtil.parseObj("{}");

        DateUtil.truncate(new Date(),DateField.DAY_OF_MONTH);
        long between = DateUtil.between(DateUtil.beginOfDay(DateUtil.parseDateTime("2022-06-27 17:55:08")),DateUtil.beginOfDay(new Date()),DateUnit.DAY);
        long between1 = DateUtil.between(DateUtil.beginOfDay(DateUtil.parseDateTime("2022-06-28 07:55:08")),DateUtil.beginOfDay(new Date()),DateUnit.DAY);
        long between2 = DateUtil.between(DateUtil.beginOfDay(DateUtil.parseDateTime("2022-06-26 07:55:08")),DateUtil.beginOfDay(new Date()),DateUnit.DAY);

        ArrayList<String> strings = ListUtil.toList("1", "2","3");
        int i = 3;
        String a = "1";
        do {
            System.out.println(a);
        } while (i++ < strings.size() && (a = strings.get(i-1)) != null );

        String json = "{\"project_id_list1\":\"2356\",\"project_id_list2\":\",3115\",\"project_id_list3\":\"[\\\"00007177\\\"]\"}";
        JSONObject jsonObject = JSONUtil.parseObj(json);
        JSONArray project_id_list3 = jsonObject.getJSONArray("project_id_list3");
        String project_id_list1 = jsonObject.getStr("project_id_list1");
        String project_id_list33 = jsonObject.getStr("project_id_list3");
        System.out.println();
    }
    @Test
    public void testList() {

        DateTime dateTime = DateUtil.offsetDay(new Date(), 16);
        DateTime offset = DateUtil.beginOfDay(new Date()).offset(DateField.DAY_OF_MONTH, 16);
        Integer a = 1;
        Integer b1 = -1;
        System.out.println(a == 1);

        List<User> list = new ArrayList<>();
        list = Collections.EMPTY_LIST;
        List<User> collect = list.stream().filter(i -> i.getAge() == 1).collect(Collectors.toList());
        System.out.println(collect);
        boolean b = list.stream().anyMatch(i -> i.getAge() == 1);
        System.out.println(b);

    }
    @Test
    public void testUrl() {
        String url = "https://rushi.huafamarkting.com";

        String s1 = StrUtil.subBetween(url,"//", ".");
        String zhhfzygj = url.replaceFirst(s1, "zhhfzygj");
        System.out.println(zhhfzygj);
        System.out.println(s1);

        String join = CollUtil.join(new ArrayList<>(), ",");
        System.out.println();

        JSONObject json = new JSONObject(new Object(),false);
        json.set("a","AA").set("b",null);
        System.out.println(json.toString());

        System.out.println(NumberUtil.div(1,2,4));
        System.out.println(NumberUtil.div(1,3,4));
        String s = NumberUtil.formatPercent(NumberUtil.div(1, 3, 4), 2);
//        System.out.println(NumberUtil.div(1,0,2));
        Date d1 = DateUtil.parseDateTime("2021-11-12 18:00:49");
        Date d2 = DateUtil.parseDateTime("2021-11-12 18:00:52");

        System.out.println(d2.getTime() - d1.getTime());
        Date now = new Date();
        System.out.println(DateUtil.beginOfDay(now));
        System.out.println(DateUtil.endOfDay(now));
        System.out.println(DateUtil.beginOfWeek(now,true));
        System.out.println(DateUtil.endOfWeek(now,true));
        System.out.println(DateUtil.beginOfMonth(now));
        System.out.println(DateUtil.endOfMonth(now));
        String urlPattern = "abc/{arg1}/2/{arg2}{arg1}";
        System.out.println(urlPattern.replaceAll("\\{arg1\\}","aa1"));
    }

    @Test
    public void testTickt() {
        String qrCode = "jQuery3412615({\n" +
                "\"code\" : 200,\n" +
                "\"ticket\" : \"AAEAMA5tdCPrUm6orcANx51w2utu6x2uCeghBCHXlPmrq9WjDur80d--uAmx0UCSAYKXoQ\"\n" +
                "})";

        String ticket = qrCode.split("\"ticket\" : \"")[1].split("\"\n}\\)")[0];
        System.out.println(ticket);

    }
    @Test
    public void testSchedule() throws IOException {

        List<Object> list = new ArrayList<>();
        list.add(new Object());
        list.add(new Object());

        for (Object o : list) {
            executorService.schedule(() -> {
                System.out.println(o.toString());
            },10, TimeUnit.SECONDS);
        }
        ThreadUtil.sleep(100000);
        System.out.println();
    }


    @Test
    public void testJsoup() throws IOException {
        Document doc = Jsoup.parse(new File("D:\\temp\\order.txt"),"utf-8");
        String dealtime = doc.selectFirst("table.order-tb  span.dealtime").text();
        String name = doc.selectFirst("table.order-tb  div.p-name a").text();
        String amount = doc.selectFirst("table.order-tb  div.amount span").text();
        LocalDateTime localDateTime = LocalDateTime.now().minusHours(1);
        LocalDateTime dateTime = DateUtil.parseLocalDateTime(dealtime);
        boolean after = dateTime.isAfter(localDateTime);
        System.out.println();

    }

    @Test
    public void testDateTime() {

        LocalDateTime dt = LocalDateTime.now();
        LocalDate localDate = dt.toLocalDate();
        LocalDate endDate = localDate.plusDays(-3);
        LocalDate now = LocalDate.now();
        long until = now.until(endDate, ChronoUnit.DAYS);
        DateTime dateTime = DateUtil.parseDateTime("2022-03-31 11:12:23");
        long between = DateUtil.between(new Date(),dateTime,DateUnit.DAY,false);
        LocalDate beginDate = LocalDate.now().minusDays(2);
        System.out.println(beginDate.toString());
        long time = DateUtil.parseDate(LocalDate.now().minusDays(2).toString()).getTime();
        System.out.println(System.currentTimeMillis());
        System.out.println(time);
    }

    @Test
    public void testMail() throws FileNotFoundException {
        List<String> msgList = new ArrayList<>();
        List<String> jueList = new ArrayList<>();
        jueList.add(StrUtil.format("{} 【{}】{}", DateUtil.date(),"jue","越来越多的开源项目从Commons Logging加Log4j转向了SLF4J加Logback"));
        jueList.add(StrUtil.format("{} 【{}】{}",DateUtil.date(),"jue","越来越多的开源项目从Commons Logging加Log4j转向了SLF4J加Logback"));
        jueList.add(StrUtil.format("{} 【{}】{}",DateUtil.date(),"jue","越来越多的开源项目从Commons Logging加Log4j转向了SLF4J加Logback"));
        jueList.add(StrUtil.format("{} 【{}】{}",DateUtil.date(),"jue","越来越多的开源项目从Commons Logging加Log4j转向了SLF4J加Logback"));
        jueList.add(StrUtil.format("{} 【{}】{}",DateUtil.date(),"jue","越来越多的开源项目从Commons Logging加Log4j转向了SLF4J加Logback"));

        StringBuilder sb = new StringBuilder();
        jueList.forEach(item -> sb.append("<div>").append(item).append("</div>"));
        msgList.add(sb.toString());

        jueList = new ArrayList<>();
        jueList.add(StrUtil.format("{} 【{}】{}", DateUtil.date(),"tm","越来越多的开源项目从Commons Logging加Log4j转向了SLF4J加Logback"));
        jueList.add(StrUtil.format("{} 【{}】{}",DateUtil.date(),"tm","越来越多的开源项目从Commons Logging加Log4j转向了SLF4J加Logback"));
        jueList.add(StrUtil.format("{} 【{}】{}",DateUtil.date(),"tm","越来越多的开源项目从Commons Logging加Log4j转向了SLF4J加Logback"));
        jueList.add(StrUtil.format("{} 【{}】{}",DateUtil.date(),"tm","越来越多的开源项目从Commons Logging加Log4j转向了SLF4J加Logback"));
        jueList.add(StrUtil.format("{} 【{}】{}",DateUtil.date(),"tm","越来越多的开源项目从Commons Logging加Log4j转向了SLF4J加Logback"));
        StringBuilder sb2 = new StringBuilder();
        jueList.forEach(item -> sb2.append("<div>").append(item).append("</div>"));
        msgList.add(sb2.toString());

        MailSender.sendMsgList("抢购列表通知",msgList);

        Map<String, InputStream> map = new HashMap<>();
        FileInputStream fileInputStream = new FileInputStream("jue.png");
        map.put("<qrcode>",fileInputStream);
        String imageName = "jue.png";

        MailUtil.send("571964946@139.com", "抢购通知", "邮件来自Hutool测试", false);
        MailUtil.sendHtml(Killer.TO_EMAIL, "登录通知", StrUtil.format("<h2>请扫码登录：{}</h2><img src=\"cid:qrcode\"/>",imageName), map,null);
        MailUtil.send("315944451@qq.com", "订单通知", "邮件来自Hutool测试", false);
        File file = new File("jue.png");
        MailUtil.sendText("571964946@139.com", "登录通知", "邮件来自Hutool测试", file);
    }
}
